#ifndef _UI_H_
#define _UI_H_

#include <config.h>
#include <hw.h>
#include <poller.h>
#include <pwin.h>
#include <lang.h>
#include <dateTime.h>
#include <httpd.h>
#include <unicode.h>
#include <keypad.h>
#include <callCtrl.h>
#include <zcomStateDispatch.h>
#include <zcom_uiPhoneSetting.h>
#include <zcom_uiAutoProvisionSetting.h>
#include <zcom_uiGtalk.h>

typedef void (UICBText)(char *buf, int bufsize,
    LangIdx text, int index, void *arg);
typedef void (UICBSelect)(void *arg);

typedef struct {
    LangIdx textIdx;                /* language-specific text */
    UICBText *textCB;               /* callback to generate string (or NULL) */
    void *textCBarg;                /* argument to text callback */
} UIMenuText;

typedef struct _UIMenuNode {
    UIMenuText text;                /* text to display */
    UICBSelect *selectCB;           /* callback when selected */
    void *selectCBarg;              /* argument to select callback */
    UICBSelect *talkCB;             /* NULL or callback for TALK key */
    /* selectCBarg is passed to talkCB also */
} UIMenuNode;

#define UI_MENU_MAXDEPTH        20

/*
 * Maximum sized string (in bytes) either displayed or entered.
 *      This INCLUDES terminating null... actual usable is thus one less.
 */
#define UI_MENU_MAXSTR          CFG_MENU_MAXSTR

/*
 * Maximum sized numerical array for array entry.  Time takes
 * 2 elements, dates takes 3 elements and IPv4 addresses take 4.
 */
#define UI_MENU_MAXNUMARRAY     4

#define SYMBOL_SELECTION_CONTENT "1 . /:@$%^&*(2 )~`-_=+[]{}3 \\|;'\"!<>,?#"
#define SYMBOL_SELECTION_SPACE_INDEX	3
#define SYMBOL_SELECTION_PER_LINE_SIZE  13
#define SYMBOL_SELECTION_LINE_NUMBER_SIZE  2

typedef struct _UIMenu {
    UIMenuText title;                   /* title to display for menu */

    enum {
        UI_MENU_TYPE_INACTIVE       = 0,        /* must be zero */
        UI_MENU_TYPE_LIST           = 1,
        UI_MENU_TYPE_TEXT_ENTRY     = 2,        /* enter unicode text */
        UI_MENU_TYPE_NUM_ENTRY      = 3,        /* enter digits 0-9 */
        UI_MENU_TYPE_NUMARRAY_ENTRY = 4,
        UI_MENU_TYPE_SCALE          = 5,
        UI_MENU_TYPE_DIALOG         = 6,
        UI_MENU_TYPE_CALENDAR       = 7,
        UI_MENU_TYPE_USER           = 8,        /* externally defined */
        UI_MENU_TYPE_HEX_ENTRY      = 9,        /* enter hexadecimal digits */
        UI_MENU_TYPE_SYMBOL_SELECTION   = 10,
        UI_MENU_TYPE_TEXT_EX_ENTRY	= 11,   //2007/04/09	lizhen
        UI_MENU_TYPE_STATUS         = 12,       /* foreground processing status */

		//by Mike
		UI_MENU_TYPE_PKEY_TEXT_ENTRY  = 15, //for Positive Key

		// for UI_MENU_TYPE_TEXT_LIST_PBOOK_V2_ENTRY
		//special for phone book search func., version 2
		// differ from UI_MENU_TYPE_TEXT_EX_ENTRY:
		//	1. only show SIP mode
		//  2. Leave 'Option' to user define langidx 
		//	3. Leave user to handle 'done' op(Positive Key).  
		//
		// May be better using UIMenuUserInit to do the same work, but we need consider more like input-method, scroll, etc.
		//  as well, the time is limited,
		// So here we just copy from UI_MENU_TYPE_TEXT_EX_ENTRY and do some changes!
		// by Mike
		UI_MENU_TYPE_TEXT_LIST_PBOOK_V2_ENTRY = 16, 
    } type;                             /* type of menu */

    unsigned short popWithParent;    /* if set, then pop this node when
                                           parent is popped */
    unsigned short currNode;    /* for http navigation; and list index */
    int lastStartNode;

    int refreshTimeoutSeconds;  // zero or how often to refresh

    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB

    UIMenuNode softKey[KEYPAD_SOFTKEY_NUM];  /* soft key text/action */

    union {

        /*
         * Parameters for UI_MENU_TYPE_LIST.  This is for displaying
         * a list of text items and allowing the user to scroll and
         * select a member of the list.
         */
        struct {
            unsigned short nNodes;      /* number of nodes in list */
            unsigned short dispTopNode; /* node index at top of display */
            unsigned short nDispLines;  /* max number of lines to display */
            unsigned char valueList;    /* list of values, rather than menus */
            unsigned char configList;   /* marks configNode valid */
            unsigned short configNode;  /* node for current configuration */
            unsigned char readonly;     /* hint to ui that this is browsing only */
            unsigned char mustSelect;   /* hint to ui that this must be selected */
            unsigned char autoAdvance;  /* scroll down when popping back to list*/
            const UIMenuNode *nodes;          /* list of menu nodes */
            // junky 2007-4-24
            int nPosList;    /*the position of scrolling string  */
            unsigned char nScrollWaitCount;

            /*
             * These callbacks allow a dynamic list.  If these are
             * set then the nodes ptr is ignored (can be NULL).
             *
             *   void (*nodeCntCB)(unsigned short *currNode,
             *                     unsigned short *nNodes, void *arg);
             *           sets the current node and numbers of nodes,
             *           only if they have independently changed.
             *   void nodeTextCB(char *str, unsigned int strSz, int node,
             *                 void *arg);
             *           returns display text in str for given node number
             *   void (*nodeSelectCB)(int node, void *arg);
             *           callback when selected
             *   void (*nodeTalkCB)(int node, void *arg);
             *           optional callback when Talk key pressed
             */
            void (*nodeCntCB)(unsigned short *currNode, unsigned short *nNodes,
                              void *arg);
            void (*nodeTextCB)(char *str, unsigned int strSz,
                             int node, void *arg);
            void (*nodeSelectCB)(int node, void *arg);
            void (*nodeTalkCB)(int node, void *arg);
            void *nodeCBArg;            /* user arg to all nodeCB funcs */

            // Tianjun 2007-3-27 13:28
            void (*nodeSelectChangedCB)(int node, void *arg);

        } list;

        /*
         * Parameters for UI_MENU_TYPE_TEXT_ENTRY and
         * UI_MENU_TYPE_NUMERIC_ENTRY.  These are for entering
         * arbitrary strings and numbers via the keypad.
         *
         * It's a little wasteful having the string in this structure
         * since there would only ever be one current text entry.
         * There's a good deal of state information for cursor navigation
         * and sequencing through characters on each keypress.
         *
         * Note: because the string is coded in utf-8, the cursorPos,
         * bufSize and lineIdx[] variables are in bytes, not characters.
         * They directly index into the utf-8 str[] array.  For cursorPos
         * and lineIdx[] they always at a full character boundary.
         */
	//2007/04/10	lizhen
        struct {
            unsigned short nNodes;      /* number of nodes in list */
            unsigned short dispTopNode; /* node index at top of display */
            //unsigned short nDispLines;  /* max number of lines to display */
            unsigned char valueList;    /* list of values, rather than menus */
            unsigned char configList;   /* marks configNode valid */
            unsigned short configNode;  /* node for current configuration */
            unsigned char readonly;     /* hint to ui that this is browsing only */
            unsigned char autoAdvance;  /* scroll down when popping back to list*/
            const UIMenuNode *nodes;          /* list of menu nodes */
			// junky 2007-4-24
			int nPosText;	/*the position of scrolling string  */
            unsigned char nScrollWaitCount;
            /*
             * These callbacks allow a dynamic list.  If these are
             * set then the nodes ptr is ignored (can be NULL).
             *
             *   void (*nodeCntCB)(unsigned short *currNode,
             *                     unsigned short *nNodes, void *arg);
             *           sets the current node and numbers of nodes,
             *           only if they have independently changed.
             *   void nodeTextCB(char *str, unsigned int strSz, int node,
             *                 void *arg);
             *           returns display text in str for given node number
             *   void (*nodeSelectCB)(int node, void *arg);
             *           callback when selected
             *   void (*nodeTalkCB)(int node, void *arg);
             *           optional callback when Talk key pressed
             */
            void (*nodeCntCB)(unsigned short *currNode, unsigned short *nNodes,
                              void *arg);
            void (*nodeTextCB)(char *str, unsigned int strSz,
                             int node, void *arg);
            void (*nodeSelectCB)(int node, void *arg);
            void (*nodeTalkCB)(int node, void *arg);
            void *nodeCBArg;            /* user arg to all nodeCB funcs */
	     void *nodeCBArgEx;

            // Tianjun 2007-3-27 13:28
            void (*nodeSelectChangedCB)(int node, void *arg);


	//////////////////////////////////////////////////////////////

            UIMenuText prompt;          /* prompt */
            void (*doneCB)(void *arg, const char *str);
                                        /* done callback */
            void *doneCBarg;            /* additional callback argument */
            char str[UI_MENU_MAXSTR]; /* current text value (utf-8) */
            char preStr[UI_MENU_MAXSTR];	//2007/04/10	lizhen
	        int SearchFlag;
            unsigned char talkDone;     /* talk button calls done */
            unsigned short bufSize;      /* buffer size in bytes */
            short lineIdx[4];           /* char index for lines around cursor */
            Pw_Font *font;              /* text font for layout calcs */
            unsigned short nDispLines;  /* max number of lines to display */
            unsigned short cursorPos;   /* cursor is before this char */
            unsigned short dispTopLine; /* line number at top of display */
            unsigned char seqState;     /* state sequence number */
            unsigned char lastKeySym;   /* last key pressed */
            UnicodeChar lastUniChar;    /* unicode last char inserted */
            unsigned char lastUtf8Sz;   /* utf8 byte length of last char */
            unsigned char shift;        /* whether we are in allcaps mode */
            unsigned short cursorX;     /* rel cursor horiz posn in pixels */
            struct pollerTask keyTimeoutTask;  /* timeout for key sequence */

            // tianjun, 2007-10-23 19:38:53
            struct pollerTask zeroKeyTimeoutTask;  /* timeout for key "0" */
            bool bZComInputMethodTypeInit;
            unsigned int ZComInputMethodTypeIndex;

			//by Mike
			LangIdx pkeyTextNilEntryIdx; //text for positive key when text entry is empty
			LangIdx pkeyTextNotNilEntryIdx; //text for positive key when text entry is not empty
			int showPBookP2P; //flag for IM Phonebook filter
        } text;

        /*
         * Parameters for UI_MENU_TYPE_NUMARRAY_ENTRY.
         * These are for entering fixed lists of numbers (eg: time/date)
         * via the keypad.
         */
        struct {
            UIMenuText prompt;          /* prompt */
            void (*doneCB)(void *arg, short valN, unsigned short *val);
                                        /* done callback */
            void *doneCBarg;            /* additional callback argument */
            unsigned short val[UI_MENU_MAXNUMARRAY];
                                        /* array values */
            unsigned short min[UI_MENU_MAXNUMARRAY];
                                        /* array min values */
            unsigned short max[UI_MENU_MAXNUMARRAY];
                                        /* array max values */
            unsigned char leadZ[UI_MENU_MAXNUMARRAY];
                                        /* #digits & display with leading 0 */
            char sep[UI_MENU_MAXNUMARRAY];
                                        /* separator characters */
            unsigned short valN;        /* number of entries */
            unsigned char edit;         /* set if editing current entry */
            unsigned char cursor;       /* index for current cursor posn */
			unsigned char bIgnoreBackEvent;
        } numarray;

        /*
         * Parameters for UI_MENU_TYPE_SCALE.  This is for displaying
         * and setting a linear scale (eg: volume).
         */
        struct {
            UIMenuText prompt;          /* prompt */
            void (*doneCB)(void *arg, unsigned short curr);
                                        /* done callback */
            void *doneCBarg;            /* additional callback argument */
            void (*chgCB)(void *arg, unsigned short curr);
                                        /* change callback */
            void *chgCBarg;             /* additional callback argument */
            unsigned char showValue;    /* if set show numeric value too */
            void (*valueCB)(int curr, int min, int max);
                                        /* callback to generate text value */
            unsigned short min;         /* minimum value */
            unsigned short max;         /* maximum value */
            unsigned short curr;        /* current value */
            unsigned int timeout;       /* optional timeout */
            struct pollerTask timeoutTask; /* timeout task for scale menu */
        } scale;

        /*
         * Parameters for UI_MENU_TYPE_DIALOG.  A dialog displays
         * some text which might include a boolean question.
         * The softkeys (or select key) can be used to respond.
         * An optional timeout makes the dialog disappear after
         * a short while.  This allows a splash message to be
         * created, which typically has no user response.
         */
        struct {
            UICBSelect *selectCB;       /* callback when selected */
            void *selectCBarg;          /* argument to select callback */
            char str[2*UI_MENU_MAXSTR]; /* text to display (may be long) */
            UIMenuText prompt;          /* may be used if str is empty */
            unsigned int timeout;       /* optional timeout */
            int protect;                /* avoid some automatic popping */
            struct pollerTask timeoutTask; /* timeout for dialog */
            int isUsedForPing;
        } dialog;

        /*
         * Parameters for UI_MENU_TYPE_CALENDAR.  A calendar displays
         * a monthly calendar and allows navigation/selection of days.
         */
        struct {
            void (*selectCB)(void *arg, DateTimeSec sec);
                                        /* select callback */
            void *selectCBarg;          /* argument to select callback */
            DateTimeSec sec;            /* current date/time (in sec format) */
            unsigned short currMDay;    /* current day of month (1..31) */
            unsigned short maxMDay;     /* days in current month (28..31) */
            unsigned short week0;       /* week# for top row of display */
            unsigned char textCBargSec; /* textCBarg is set to sec if true */
            short firstDig;             /* first digit key (-1 if none) */
        } calendar;

        /*
         * Parameters for UI_MENU_TYPE_USER.  This is for any
         * user-level application that wants basic menu wrappers
         * like the title and soft keys.
         */
        struct {
			int nPosUser;  /*the position of scrolling string  */
            Pw_Bool (*eventHandler)(struct _UIMenu *menu, Pw_Event *ev);
                                        /* user PW event handler callback */
            void (*repaintHandler)(struct _UIMenu *menu, Pw_GC *gc,
                                Pw_Coord y0, Pw_Coord y1);
                                        /* user PW window repaint callback */
            void (*softKeyUpdate)(struct _UIMenu *menu);
            void *userData;
#if CFG_HTTPD_ENABLE
            void (*httpNavGoTo)(int node, int level, int maxLevel, int doOpen);
            void (*httpNavLink)(struct _UIMenu *menu, HttpdOutput *output,
                                char *parentUrl, int level);
            void (*httpContent)(HttpdOutput *output, char *url);
            void (*httpSubmit)(HttpdOutput *output, char *paramList[]);
#endif
        } user;
        //
        // Parameters for symbol selection
        //
        struct
        {
            void (*doneCB)(void *arg, const char symbol);
                                        /* done callback */
            void *doneCBarg;            /* additional callback argument */
            char str[UI_MENU_MAXSTR]; /* current text value (utf-8) */
            unsigned short cursorPos;   /* cursor position this char, index from 0 */
        } symbol_selection;


        /*
         * Parameters for UI_MENU_TYPE_STATUS.
         * This is for a "foreground" activity that the user must
         * wait for except that they can cancel it... and the
         * status of the activity can be updated regularly.
         * The "menu" has three states:
         *      in-progress:
         *              user can press cancel
         *      failed:
         *              user can press cancel or retry
         *      done:
         *              user can press done
         */
        struct {
            void (*updateCB)(
                char msg[],     /* output: status message to show */
                int msgMax,     /* sizeof(msg[]) */
                int *failureP,  /* output: nonzero on failure */
                int *successP   /* output: nonzero on success */
                );
            char msg[2*UI_MENU_MAXSTR];      /* buffer for current message */
            int failure;        /* nonzero for failure status */
            int success;        /* nonzero for success status */
            UICBSelect *selectCB;       /* callback when selected */
            void *selectCBarg;          /* argument to select callback */
            struct pollerTask timeoutTask; /* timeout for dialog */
#if CFG_HTTPD_ENABLE
            void (*httpNavGoTo)(int node, int level, int maxLevel, int doOpen);
            void (*httpNavLink)(struct _UIMenu *menu, HttpdOutput *output,
                                char *parentUrl, int level);
            void (*httpContent)(HttpdOutput *output, char *url);
            void (*httpSubmit)(HttpdOutput *output, char *paramList[]);
#endif
        } status;
    } m;
} UIMenu;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    unsigned short nNodes;              /* number of nodes in list */
    unsigned short currNode;            /* current node index */
    unsigned short nDispLines;          /* max number of lines to display */
    unsigned char valueList;            /* list of values, rather than menus */
    unsigned char configList;   /* indicates that configNode valid */
    unsigned short configNode;  /* mark line as for current configuration */
    unsigned char readonly;     /* hint to ui that this is browsing only */
    unsigned char mustSelect;   /* hint to ui that this must be selected */
    unsigned char autoAdvance;  /* scroll down when popping back to list*/
    const UIMenuNode *nodes;                  /* list of menu nodes */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
    /*
     * Dynamic list functions.  If set, nodes is ignored.
     * See UIMenu structure for more info.
     */
    void (*nodeCntCB)(unsigned short *currNode, unsigned short *nNodes,
                      void *arg);
    void (*nodeTextCB)(char *str, unsigned int strSz,
                     int node, void *arg);
    void (*nodeSelectCB)(int node, void *arg);
    void (*nodeTalkCB)(int node, void *arg);
    void *nodeCBArg;            /* user arg to all nodeCB funcs */

    // Tianjun 2007-3-27 13:28
    void (*nodeSelectChangedCB)(int node, void *arg);

} UIMenuListInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UIMenuText prompt;                  /* prompt */
    char str[UI_MENU_MAXSTR];         /* initial text value */
    unsigned short bufSize;              /* buffer size */
    unsigned short cursorPos;           /* initial cursor position */
    void (*doneCB)(void *arg, const char *str);
                                        /* done callback */
    void *doneCBarg;                    /* additional callback argument */
    unsigned char shift;                /* whether we are in allcaps mode */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB

    //2007/04/11	lizhen
    void (*nodeCntCB)(unsigned short *currNode, unsigned short *nNodes,
                      void *arg);
    void (*nodeTextCB)(char *str, unsigned int strSz,
                     int node, void *arg);
    void (*nodeSelectCB)(int node, void *arg);
    void (*nodeSelectChangedCB)(int node, void *arg);
    void (*nodeTalkCB)(int node, void *arg);
    void *nodeCBArg;            /* user arg to all nodeCB funcs */
    void *nodeCBArgEx;

    bool bZComInputMethodTypeInit;
    unsigned int ZComInputMethodTypeIndex;
} UIMenuTextEntryInit;

//by Mike
typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UIMenuText prompt;                  /* prompt */
    char str[UI_MENU_MAXSTR];         /* initial text value */
    unsigned short bufSize;              /* buffer size */
    unsigned short cursorPos;           /* initial cursor position */
    void (*pkeyCB)(void *arg, const char *str);
                                        /* positive key callback */
    void *pkeyCBarg;                    /* additional callback argument */
    unsigned char shift;                /* whether we are in allcaps mode */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB

    //2007/04/11	lizhen
    void (*nodeCntCB)(unsigned short *currNode, unsigned short *nNodes,
                      void *arg);
    void (*nodeTextCB)(char *str, unsigned int strSz,
                     int node, void *arg);
    void (*nodeSelectCB)(int node, void *arg);
    void (*nodeSelectChangedCB)(int node, void *arg);
    void *nodeCBArg;            /* user arg to all nodeCB funcs */
    void *nodeCBArgEx;

    bool bZComInputMethodTypeInit; //new
    unsigned int ZComInputMethodTypeIndex; //new

	//must fill below two fields
	//by Mike
	LangIdx pkeyTextNilEntryIdx; //text for positive key when text entry is empty
	LangIdx pkeyTextNotNilEntryIdx; //text for positive key when text entry is not empty

} UIMenuPKeyTextEntryInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UIMenuText prompt;                  /* prompt */
    char str[UI_MENU_MAXSTR];         /* initial text value */
    unsigned short bufSize;              /* buffer size */
    unsigned short cursorPos;           /* initial cursor position */
    void (*doneCB)(void *arg, const char *str);
                                        /* done callback */
    void *doneCBarg;                    /* additional callback argument */
    unsigned char shift;                /* whether we are in allcaps mode */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB

    //2007/04/11	lizhen
    void (*nodeCntCB)(unsigned short *currNode, unsigned short *nNodes,
                      void *arg);
    void (*nodeTextCB)(char *str, unsigned int strSz,
                     int node, void *arg);
    void (*nodeSelectCB)(int node, void *arg);
    void (*nodeSelectChangedCB)(int node, void *arg);

	//by Mike
	LangIdx pkeyTextEntryIdx; //text for positive key, must fill it
	int showPBookP2P; //flag for IM Phonebook filter
} UIMenuText_List_PBook_V2_EntryInit;

typedef struct {
    /* Used for UI_MENU_TYPE_NUM_ENTRY and UI_MENU_TYPE_HEX_ENTRY */
    UIMenuText title;                   /* title to display for menu */
    UIMenuText prompt;                  /* prompt */
    char str[UI_MENU_MAXSTR];         /* initial text value */
    unsigned char talkDone;             /* talk button calls done */
    unsigned short bufSize;              /* buffer size */
    unsigned short cursorPos;           /* initial cursor position */
    void (*doneCB)(void *arg, const char *str);
                                        /* done callback */
    void *doneCBarg;                    /* additional callback argument */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB

    int preInputKeySym; // tianjun, 2007-10-23 23:24:42
} UIMenuNumEntryInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UIMenuText prompt;                  /* prompt */
    void (*doneCB)(void *arg, unsigned short curr);
                                        /* done callback */
    void *doneCBarg;                    /* additional callback argument */
    void (*chgCB)(void *arg, unsigned short curr);
                                        /* change callback */
    void *chgCBarg;                     /* additional callback argument */
    unsigned char showValue;            /* if set show numeric value too */
    void (*valueCB)(int curr, int min, int max);
                                        /* callback to generate text value */
    unsigned short min;                 /* minimum value */
    unsigned short max;                 /* maximum value */
    unsigned short curr;                /* current value */
    unsigned int timeout;               /* optional timeout */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
} UIMenuScaleInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UIMenuText prompt;                  /* prompt */
    void (*doneCB)(void *arg, short valN, unsigned short *val);
                                        /* done callback */
    void *doneCBarg;                    /* additional callback argument */
    unsigned short val[UI_MENU_MAXNUMARRAY];
                                        /* array values */
    unsigned short min[UI_MENU_MAXNUMARRAY];
                                        /* array min values */
    unsigned short max[UI_MENU_MAXNUMARRAY];
                                        /* array max values */
    unsigned char leadZ[UI_MENU_MAXNUMARRAY];
                                        /* #digits & display with leading 0 */
    char sep[UI_MENU_MAXNUMARRAY];      /* separator characters */
    unsigned short valN;                /* number of entries */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB

    unsigned char bIgnoreBackEvent;
} UIMenuNumArrayEntryInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UICBSelect *selectCB;               /* callback when selected */
    void *selectCBarg;                  /* argument to select callback */
    int protect;                        /* avoid some automatic popping */
    char str[2*UI_MENU_MAXSTR];         /* text to display (may be long) */
    UIMenuText prompt;                  /* may be used if str is empty */
    unsigned int timeout;               /* optional timeout */
    unsigned int customSoftKey;         /* set if softkeys are custom */
    UIMenuNode softKey[KEYPAD_SOFTKEY_NUM]; /* soft key text/action */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
    int isUsedForPing;
} UIMenuDialogInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    void (*selectCB)(void *arg, DateTimeSec sec);
                                        /* select callback */
    void *selectCBarg;                  /* argument to select callback */
    DateTimeSec sec;                    /* current day */
    unsigned char textCBargSec;         /* textCBarg is set to sec if true */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
} UIMenuCalendarInit;

typedef struct {
    UIMenuText title;                   /* title to display for menu */
    UIMenuNode softKey[KEYPAD_SOFTKEY_NUM];
                                        /* soft key text/action */
    Pw_Bool (*eventHandler)(UIMenu *menu, Pw_Event *ev);
                                        /* user PW event handler callback */
    void (*repaintHandler)(UIMenu *menu, Pw_GC *gc, Pw_Coord y0, Pw_Coord y1);
                                        /* user PW window repaint callback */
    void (*softKeyUpdate)(struct _UIMenu *menu);
    void *userData;
#if CFG_HTTPD_ENABLE
    void (*httpNavGoTo)(int node, int level, int maxLevel, int doOpen);
    void (*httpNavLink)(struct _UIMenu *menu, HttpdOutput *output,
                        char *parentUrl, int level);
    void (*httpContent)(HttpdOutput *output, char *url);
    void (*httpSubmit)(HttpdOutput *output, char *paramList[]);
#endif
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
    int currNode;       /* for http support; should match current EntryId */
} UIMenuUserInit;

typedef struct
{
    /* Used for UI_MENU_TYPE_SYMBOL_SELECTION */
    UIMenuText title;                   /* title to display for menu */
    char str[UI_MENU_MAXSTR];         /* initial text value */
    unsigned short cursorPos;           /* initial cursor position */
    void (*doneCB)(void *arg, const char symbol);
                                        /* done callback */
    void *doneCBarg;                    /* additional callback argument */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
} UIMenuSymbolSelectionInit;

typedef struct {        /* for UI_MENU_TYPE_STATUS */
    UIMenuText title;                   /* title to display for menu */
    /* If selectCB is not provided, a uiMenuPop is done */
    UICBSelect *selectCB;               /* callback when selected */
    void *selectCBarg;                  /* argument to select callback */
    /* cleanupCB is called by uiMenuPop() to release resources.
     * It MUST NOT in anyway mess with the menu stack!
     */
    void (*cleanupCB)(void *);
    void *cleanupCBArg;                   // passed to cleanupCB
    /* updateCB is called back periodically */
    void (*updateCB)(
        char msg[],     /* output: status message to show */
        int msgMax,     /* sizeof(msg[]) */
        int *failureP,  /* output: nonzero on failure */
        int *successP   /* output: nonzero on success */
        );
    int updateSeconds;  /* how often (seconds) to call update callback */
#if CFG_HTTPD_ENABLE
    void (*httpNavGoTo)(int node, int level, int maxLevel, int doOpen);
    void (*httpNavLink)(struct _UIMenu *menu, HttpdOutput *output,
                        char *parentUrl, int level);
    void (*httpContent)(HttpdOutput *output, char *url);
    void (*httpSubmit)(HttpdOutput *output, char *paramList[]);
#endif
} UIMenuStatusInit;

extern void uiInit(void);
extern int uiMenuLevelGet(void);
extern UIMenu* uiMenuTopGet(void);
/*
 * uiMenuRefresh -- schedule redraw of currently displayed menu
 */
extern void uiMenuRefresh(void);
/*
 * uiMenuWindowRepaint -- redraw currently displayed menu NOW
 *      regardless of other priorities.
 *      Use with great discretion!
 */
extern void uiMenuWindowRepaint(void);
extern void uiMenuActivate(void);
extern void uiMenuPop(int activate);
extern void uiMenuPopAll(void);
extern void uiMenuPopLevel(int level, int activate);
extern void uiMenuPopLevelOnly(UIMenu * level, int activate);
extern int  uiMenuLevelTop(void);
extern void uiMenuInit(Pw_Display* dpy);
extern void uiMenuTextGet(const UIMenuText *text, char *buf, int bufsize);

extern void uiMenuListInit(const UIMenuListInit *init);
extern void uiMenuTextEntryInit(const UIMenuTextEntryInit *init);
extern void uiMenuPKeyTextEntryInit(const UIMenuPKeyTextEntryInit *init); //by Mike
extern void uiMenuText_List_PBook_V2_EntryInit(const UIMenuText_List_PBook_V2_EntryInit *init); //by MIke
extern void uiMenuTextExEntryInit(const UIMenuTextEntryInit *init);//2007/04/09	lizhen
extern void uiMenuNumEntryInit(const UIMenuNumEntryInit *init);
extern void uiMenuHexEntryInit(const UIMenuNumEntryInit *init);
extern void uiMenuScaleInit(const UIMenuScaleInit *init);
extern void uiMenuNumArrayEntryInit(const UIMenuNumArrayEntryInit *init);
extern UIMenu * uiMenuDialogInit(const UIMenuDialogInit *init, UIMenu *oldmenu );
extern void uiMenuCalendarInit(const UIMenuCalendarInit *init);
extern UIMenu * uiMenuUserInit(const UIMenuUserInit *init, UIMenu *oldmenu);
extern void uiMenuSymbolSelectionInit(const UIMenuSymbolSelectionInit *init);
extern UIMenu * uiMenuStatusInit(const UIMenuStatusInit *init);
extern void uiMenuDialogMesgTimed(
        LangIdx title,                 /* title of dialog */
        const char *str                /* string to display */
    );
extern void uiMenuDialogErrMsg(
        LangIdx err
    );
UIMenu * uiMenuDialogMesgYes(
        LangIdx title,
        const char *str,
        UICBSelect *selectCB,          /* callback when selected */
        void *selectCBarg,             /* argument to select callback */
        void (*cleanupCB)(void *),     /* NULL or called when menu popped */
        void *cleanupCBArg,            /* passed to cleanupCB */
        UIMenu *oldmenu
    );

extern UIMenu * uiMenuDialogMesgOk(
        UIMenuText title,
        const char *str
        );

extern int uiMenuDialogTextLayout(
        const char *str,
        Pw_GC *gc,
        int font,
        int mustFit,
        Pw_Coord y0,
        Pw_Coord y1,
        Pw_Coord x,
        Pw_Coord w,
        int drawBox
    );
extern void uiDialogNotImplemented(void *data);
extern void uiMenuScrollBarDraw(Pw_GC *gc, Pw_Coord w,
                         Pw_Coord y0, Pw_Coord y1,
                         unsigned int value, unsigned int max);

void uiMenuKeyEvent(
        int press,              /* 0 = release, 1 = press */
        int keycode,            /* see keypad.h */
        int keyRepeat           /* 0 = normal, 1 = auto-repeat generated */
        );
extern void uiMenuSoftKeyNegative(UIMenuNode node[], LangIdx strIdx);
extern void uiMenuSoftKeyPositive(UIMenuNode node[], LangIdx strIdx);
extern void uiMenuSoftKeyCBNegative(UIMenuNode node[], LangIdx strIdx,
                            UICBSelect *selectCB, void *selectCBarg);
extern void uiMenuSoftKeyCBPositive(UIMenuNode node[], LangIdx strIdx,
                            UICBSelect *selectCB, void *selectCBarg);
int uiMenuShortcutHintShown(void);


extern Pw_Display *uiDisplay(void);

extern void uiPowerInit(void);
extern void uiPowerKeyPress(void);
extern void uiPowerKeyRelease(void);

extern void uiMenuMainStart(void *data);

extern void uiMainWinKeyEnd(void);
extern void uiMainWinKeyTalk(const char *num);
extern void uiMainWinNumberFromBookLogDone(
    const char *numstr, const char *namestr, unsigned char numtype );
extern void uiMainWinInit(void);

const UIMenuListInit uiClockDateTimeSet;

#define UI_DATETIME2STR_SHOW_DATE    (1 << 0)
#define UI_DATETIME2STR_SHOW_YEAR    (1 << 1)
#define UI_DATETIME2STR_SHOW_TIME    (1 << 2)
#define UI_DATETIME2STR_SHOW_SEC     (1 << 3)
#define UI_DATETIME2STR_SHOW_HOUR (1 << 4)

extern int uiDateTime2Str(char *buf, int bufsize, DateTimeSec time,
                           unsigned options);
extern void uiDateTimeCal2Str(char *buf, int bufsize,
                    unsigned int year, unsigned int month, unsigned int mday,
                    unsigned int hour, unsigned int min, unsigned int sec,
                    unsigned options);
extern void uiTime2Str(char *buf, int bufsize,
                    unsigned int hour, unsigned int min, unsigned int sec,
                    unsigned options);

#if CFG_ALARM_ENABLE()
extern void uiAlarmStart(void *data);
extern void uiAlarmInit(void);
extern void uiAlarmAlert(void);
#endif

int uiPhoneBookRingToneTestingGet(void);
extern unsigned uiPhoneSettingsRingToneIdGet(void);
extern int uiPhoneSettingsVibrateGet(void);
//2006/12/4		lizhen
//extern void uiPhoneSettingsGreetingGet(int IProfile, char *buf, int bufsize);
//extern void uiPhoneSettingsEditReceiverVolumeStart(void *data);
void uiPhoneSettingsEditVolumeStart(void);
void uiCallVolumeDialogStart(void);

/*-F- uiPhoneSettingsRingToneClean -- handle disappearing ring tone.
*       Sets matching ring tone ids to zero (== use default).
*/
//void uiPhoneSettingsRingToneClean(
//        unsigned RingToneId
//        );


extern void uiWlanProfileMenuStart(void *data);
extern void uiWlanProfileCreateNameStart(void *data);
extern void uiWlanProfileInit(void);

extern void uiWlanStateResetMenuStart(void *data);
extern void uiWlanStateAutoConfigMenuStart(void *data);
extern void uiWlanStateScanListMenuStart(void *data);
extern void uiWlanStateInit(void);
extern void zcom_uiWlanStateInit(void);
extern void zcom_uiWlanStateScanListMenuStart(void *data);

//extern void uiRingToneSelectStart(
//        void (*selectCB)(int  id, void *data),
//        void *data,
//        int currId
//    );
void uiMelodySelectStart(
        void (*selectCB)(int id, void *data),
        void *data,
        int submenu,
        int currId
    );
void uiRecordingSelectStart(
        void (*selectCB)(int id, void *data),
        void *data,
        int currId
    );
extern void uiTelephoneToneSelectStart(
        void (*selectCB)(int  id, void *data),
        void *data,
        int currId
    );
//extern void uiStopWatchInit(void *data);

//extern void uiPhoneInfoStart(void *data);

extern void uiFirmwareInit(void);
extern bool uiFirmwareIsUpgrading(void);
extern void uiFirmwareStart(void *);

extern void uiRemoteAccessInit(void);
void uiRemoteAccessStart(void *data);

extern void uiMenuCallMenuStart(void);

//2006/10/20	lizhen
#define CALLLOG_MISSED_CALL             1       /* missed incoming */
#define CALLLOG_DIALED_CALL             2       /* accepted outgoing */
#define CALLLOG_RECEIVED_CALL           4       /* accepted incoming */
#define CALLLOG_UNANSWERED_CALL         8       /* not accepted outgoing */
extern void uiCallLogInit(void);
extern void uiCallLogDialByOrderId(void* data);
extern void uiCallLogNameSelectStart(void *data);
extern void uiCallLogListCallLogStart(void *data);
extern void uiCallLogNameMissedCallsSelectStart(void *data);
extern void uiCallLogNameReceivedCallsSelectStart(void *data);
extern void uiCallLogNameDialledCallsSelectStart(void *data);
extern void uiCallLogEntry(void *data);
extern void uiCallLogEntryDeleteAllStart(void* data);
extern void uiCallLogOptionsStart(void);
extern void uiCallLogMissedNewStart(void *data, const char *numStr,
                                    DateTimeSec secStart,
                                    DateTimeSec secEnd,
                                    unsigned char numtype);
extern void uiCallLogDialedNewStart(void *data, const char *numStr,
                                    DateTimeSec secStart,
                                    DateTimeSec secEnd,
                                    unsigned char numtype);
extern void uiCallLogReceivedNewStart(void *data, const char *numStr,
                                      DateTimeSec secStart,
                                      DateTimeSec secEnd,
                                      unsigned char numtype);
void uiCallLogDialedUnansweredStart( void *data, const char *numStr,
                              DateTimeSec secStart,
                              DateTimeSec secEnd,
                              unsigned char numtype );


//2007/03/27	lizhen
extern void uiCallLogMissedNewStartSave( void *data, const char *numStr,
                              DateTimeSec secStart,
                              unsigned activeSec,
                              unsigned char numtype );


extern void uiCallLogReceivedNewStartSave( void *data, const char *numStr,
                                DateTimeSec secStart,
                                unsigned activeSec,
                                unsigned char numtype );


extern void uiCallLogDialedUnansweredStartSave( void *data, const char *numStr,
                              DateTimeSec secStart,
                              unsigned activeSec,
                              unsigned char numtype );


extern void uiCallLogDialedNewStartSave( void *data, const char *numStr,
                              DateTimeSec secStart,
                              unsigned activeSec,
                              unsigned char numtype );

//junky 2007-4-26
void zcom_DrawScrollingStringForList(
							 Pw_GC*   gc,
							 Pw_Coord x,
							 Pw_Coord y,
							 const Pw_Char* string,
							 Pw_TextAnchorType anchor,
							 int width);

void zcom_DrawScrollingStringForUser(
							 Pw_GC*   gc,
							 Pw_Coord x,
							 Pw_Coord y,
							 const Pw_Char* string,
							 Pw_TextAnchorType anchor,
							 int canfit);

void zcom_DrawScrollingStringForText(
									 Pw_GC*   gc,
									 Pw_Coord x,
									 Pw_Coord y,
									 const Pw_Char* string,
									 Pw_TextAnchorType anchor,
									 int width);
void zcom_InitScrollingStrStatusForUser();

extern void uiNetworkSetupCommitStart(void *data);
extern void uiNetworkSetupDiscardStart(void *data);
extern void uiNetworkSetupDHCPStart(void *data);
extern void uiNetworkSetupIPStart(void *data);
extern void uiNetworkSetupNetmaskStart(void *data);
extern void uiNetworkSetupGatewayStart(void *data);
extern void uiNetworkSetupSIP_IPStart(void *data);
extern void uiNetworkSetupSIP_PortStart(void *data);
extern void uiNetworkSetupProxyIPStart(void *data);
extern void uiNetworkSetupProxyPortStart(void *data);
extern void uiNetworkSetupProxyUserStart(void *data);
extern void uiNetworkSetupProxyPasswdStart(void *data);
extern void uiNetworkSetupOurPhoneNumberStart(void *data);
extern void uiNetworkSetupHighCompressionStart(void *data);
extern void uiNetworkSetupAcousticEchoCancellationStart(void *data);
extern void uiNetworkSetupInit(void);

extern void uiCalculatorStart(void *data);

extern void uiCalendarStart(void *data);

extern void uiRecordVoiceInit(void);
extern void uiRecordPlayMenuStart(void *data);


extern void uiPlayInit(void);
extern unsigned uiPlayIdGet(void);
extern void uiPlayStop(void);
extern void uiPlayAuplay(int AuplayId);
extern void uiPlayAuplayOnce(int AuplayId);
extern void uiPlayPureTone(int hz);
extern void uiPlayDtmf(int key);
extern void uiPlayTelephoneTone(int toneCode);
extern void uiPlayRainbowTone(int unused);
extern void uiPlayMelody(int melodyNumber);
extern void uiPlayCallTone_IncomingRing(void);
extern void uiPlayCallTone_OutgoingRing(void);
extern void uiPlayRecording(int recordingIdx);
extern void uiPlayRecordingWithCallback(int recordingIdx, void (*DoneCB)(void));
extern void uiPlayMelodyStart(void *data);
extern void uiPlayRecordingStart(void *data);
extern void uiPlaySystemToneStart(void *data);

extern void uiKeyInit(void);
extern void uiKeyRepeatCancel(void);
void uiKeyRepeatTimeSet(
        unsigned int firstRepeatTime,   /* first relative repeat time */
        unsigned int nextRepeatTime     /* subsequent relative time */
    );
extern void uiKeyRepeatTimeSet(
        unsigned int firstRepeatTime,   /* first relative repeat time */
        unsigned int nextRepeatTime     /* subsequent relative time */
    );
extern void uiKeyClick(
        int Press,              // 0=released, 1=pressed, -1 = terminate
        int Keycode,            // KEYCODE_* values
        int KeyRepeat           // nonzero for auto-repeated press
        );

void uiKeyClickStop(void);
extern int uiKeyCodeToAuplayDtmf( int KeyCode );
//extern void uiKeyDtmfMenuStart(void *data);
extern void uiKeyDtmfPlayModeSet(int PlayMode);

#if CFG_HTTPD_ENABLE

extern void uiHttpHeader(HttpdOutput *output, char *title);
extern void uiHttpTrailer(HttpdOutput *output);
extern void uiMenuHttpNavGoTo(char *url);
extern void uiHttpNavLink(HttpdOutput *output, const char *text, char *url,
                          int selected, int indent);
extern void uiHttpContent(HttpdOutput *output);
extern void uiHttpH1(HttpdOutput *output, char *text);
extern void uiHttpH2(HttpdOutput *output, char *text);
extern void uiHttpdInit(void);

extern void uiMenuHttpNavLink(HttpdOutput *output, char *url, int level);
extern void uiMenuHttpContent(HttpdOutput *output);
extern void uiMenuHttpSubmit(HttpdOutput *output, char *value);

#endif /* CFG_HTTPD_ENABLE */

#if CFG_GTALK_ENABLE()
extern void uiGtalkInit(void);
#endif /* CFG_GTALK_ENABLE */

extern void zcom_uiMenuListReInit_ForLevel(const UIMenuListInit *init, int level);
extern void zcom_uiWlanProfileList(void *data);
extern void zcom_uiWlanProfileAdd(void *data);
extern void zcom_WlanProfileDeleteAll(); // to delete all wlan profiles
extern void zcom_SetlwipBasicConfig(struct lwipNetworkConfig *IPSetup);
extern void zcom_uiSipProfileList(void *data);
extern void zcom_uiSipProfileAdd(void *data);
extern void zcom_SipProfileDeleteAll(); // to delete all sip profiles
extern const char* zcom_GetVOIPDisplayName(); // to get current Display name
extern const char* zcom_GetPhoneNumber(); // to get current phone number
extern void zcom_ReconnectStart(void *data);
extern void uiFirmwareUpgradeDone( int Success );
extern void uiPowerShutdownAndGoodbye();
extern void uiPowerRebootAndGoodbye();
extern int zcom_WlanProfileAdd(void* data);
extern void zcom_WlanProfileDelete(void* data);
extern void zcom_WlanProfileEdit(int iProfile, void* ProfileP);
extern int zcom_WlanProfileGetIndexByName(char* ProfileName);
extern int zcom_WlanProfileAddFromAutoProvision(void * data);
extern void zcom_WlanProfileConnectFromAutoProvision(int iProfile);
extern int zcom_SipProfileAdd(void *data);
extern void zcom_SipProfileDelete(void* data);
extern void zcom_SipProfileEdit(int iProfile, void* ProfileP);
extern void* zcom_SipProfilePGet(int iProfile);
extern int zcom_SipProfileNameToIndex(char *Name);
extern void zcom_SipProfileCodecOrderValidate(void);
extern void zcom_CodecOrderValidate(struct callCtrlVoipConfig* SipProfile);
extern void zcom_CodecOrderSelectByIndex(struct callCtrlVoipConfig* AdvanceProfile, int CodecOrderIndex);
extern int zcom_CodecOrderGetIndex(struct callCtrlVoipConfig* AdvanceProfile);
extern bool zcom_CodecOrderG729EnableCheck();
extern int zcom_uiProvisionSIPProfileNameToIndex(char *Name);
extern void zcom_uiInformationStart(void *data);
//extern void zcom_uiPhoneSettingWebAutoProvisionServerAddress(const char *str);
//extern void zcom_uiPhoneSettingWebAutoProvisionServerPort(const char *str);
//extern void zcom_uiPhoneSettingWebAutoProvisionRetryInterval(const char *str);
//extern void zcom_uiPhoneSettingWebAutoProvisionExpireInterval(const char *str);
//extern void zcom_uiPhoneSettingWebAutoProvisionActivate();
//extern void zcom_uiPhoneSettingWebAutoProvisionDeactivate();
//extern bool zcom_uiPhoneSettingWebAutoProvisionActivateGet();
//extern const char* zcom_uiPhoneSettingWebAutoProvisionServerAddressGet(void);
//extern unsigned long zcom_uiPhoneSettingWebAutoProvisionServerPortGet(void);
//extern unsigned long zcom_uiPhoneSettingWebAutoProvisionRetryIntervalGet(void);
//extern unsigned long zcom_uiPhoneSettingWebAutoProvisionExpireIntervalGet(void);
//
// Phone Lock Definitions
//
typedef enum _ZCOM_PHONE_LOCK_SETTING_ {
    Zcom_Phone_Lock_OFF,
    Zcom_Phone_Lock_15s,
    Zcom_Phone_Lock_30s,
    Zcom_Phone_Lock_60s,
    Zcom_Phone_Lock_120s
} ZCOM_PHONE_LOCK_SETTING;

#define ZCOM_UIPHONESETTING_PHONE_LOCK_DEFAULT Zcom_Phone_Lock_OFF

extern const char* zcom_GetFirmwareUpgradeAddress(void);

extern void zcom_SetFirmwareUpgradeAddress(const char *str);

extern unsigned long zcom_GetFirmwareUpgradePort(void);

extern void zcom_SetFirmwareUpgradePort(unsigned long port);

//extern ZCOM_PHONE_LOCK_SETTING zcom_GetPhoneLockSetting();
//extern void zcom_SetPhoneLockSetting(ZCOM_PHONE_LOCK_SETTING PhoneLockState);

extern void uiClockTimeZoneInit(void);
extern void uiClockDateTimeSetStart(void);
extern void zcom_uiClockDateTimeSetWizard(void);

//2007/02/02    lizhen
extern void uiMainWinStateUpdateNotify(
	enumStep step,
	enumState state,
	enumErrorCode errorCode,
	LangIdx errorDesc);

enum zcom_RingMode
{
    zcom_RingMode_Ring_Only,
    zcom_RingMode_Vibrate,
    zcom_RingMode_Vibrate_And_Ring,
    zcom_RingMode_Vibrate_Then_Ring,
    zcom_RingMode_Silent
};

extern unsigned uiProfileSettingsCurrentRingToneIdGet();
extern unsigned uiProfileSettingsCurrentMessageToneIdGet();
extern unsigned char uiProfileSettingsCurrentKeyToneIsEnabled();
extern enum zcom_RingMode uiProfileSettingsCurrentRingModeGet();

extern void zcom_uiProfilesSettingInit(void);
extern void zcom_uiProfilesSettingStart(void *data);
extern void zcom_uiProfilesResetFactory(void);
extern void zcom_uiRestoreFactoryAndReboot(void *data);

extern void zcom_StartAutoKeypadLockJob();

extern void zcom_uiProfilesSwitchMeetingAndCurrent(void);

extern int uiTextLayout(
						const char *str,        /* text to be laid out */
						int nLines,          /* maximum no. of lines allowed */
						Pw_GC *gc,
						int font,
						int mustFit,
						Pw_Coord y0,
						Pw_Coord y1,
						Pw_Coord x,
						Pw_Coord w
						);

extern int zcom_uiCallSettingIsCallerIDOff();
extern void zcom_uiCallSettingSetCallerIDConfig(int bCallerIDOff);
extern struct callCtrlAnswerConfig *zcom_uiCallSettingGetAnswerConfig();
extern void zcom_uiCallSettingDone(void *data);

extern void zcom_uiSipProfileActive(void *data);

extern void zcom_uiP2PEntryStart(void);
extern void zcom_uiP2PEntryStartWithNumber(const char* Number);

typedef struct _ZCOM_KEYPADLOCK_KEYCOMBINATION_
{
    int first_keycode;
    int next_keycode;
} ZCOM_KEYPADLOCK_KEYCOMBINATION;
extern ZCOM_KEYPADLOCK_KEYCOMBINATION g_zcomKeypadLockKeyCombination;

#endif /* _UI_H_ */
